home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Griffith 0.9.8 / griffith-0.9.8-win32.exe / {app} / lib / plugins / movie / PluginMovieCulturalia.py < prev    next >
Text File  |  2008-11-17  |  5KB  |  131 lines

  1. # -*- coding: iso-8859-15 -*-
  2.  
  3. __revision__ = '$Id: PluginMovieCulturalia.py 389 2006-07-29 18:43:35Z piotrek $'
  4.  
  5. # Copyright (c) 2006 Pedro D. Sßnchez
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU Library General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  20.  
  21. # You may use and distribute this software under the terms of the
  22. # GNU General Public License, version 2 or later
  23.  
  24. import gutils
  25. import movie
  26. import string
  27.  
  28. plugin_name        = 'Culturalia'
  29. plugin_description    = 'Base de Datos de Peliculas'
  30. plugin_url        = 'www.culturalianet.com'
  31. plugin_language        = _('Spanish')
  32. plugin_author        = 'Pedro D. Sßnchez'
  33. plugin_author_email    = '<pedrodav@gmail.com>'
  34. plugin_version        = '0.2'
  35.  
  36. class Plugin(movie.Movie):
  37.     def __init__(self, id):
  38.         self.encode='iso-8859-15'
  39.         self.movie_id = id
  40.         self.url = "http://www.culturalianet.com/art/ver.php?art=%s" % str(self.movie_id)
  41.  
  42.     def get_image(self):
  43.         tmp = string.find(self.page, "<font class = 'titulo2'>")
  44.         if tmp == -1:
  45.             self.image_url = ''
  46.         else:
  47.             self.image_url = 'http://www.culturalianet.com/art/'+gutils.trim(self.page[tmp:], '<img src = "', '"')
  48.  
  49.     def get_o_title(self):
  50.         self.o_title = gutils.trim(self.page, "<font class = 'titulo2'>", '</i>')
  51.         self.o_title = gutils.after(self.o_title, '<i>')
  52.  
  53.     def get_title(self):
  54.         self.title = gutils.trim(self.page, "<font class = 'titulo2'>", '. (')
  55.  
  56.     def get_director(self):
  57.         self.director = gutils.trim(self.page,"<font class = 'titulo3'>Director:", '<br><br>')
  58.  
  59.     def get_plot(self):
  60.         self.plot = gutils.trim(self.page, '<b>Sinopsis:</b><br>', '<br><br>')
  61.  
  62.     def get_year(self):
  63.         self.year = gutils.trim(self.page, "<font class = 'titulo2'>", ')</font>')
  64.         self.year = gutils.after(self.year, '. (')
  65.  
  66.     def get_runtime(self):
  67.         self.runtime = gutils.trim(self.page, "<font class = 'titulo3'>Duraci≤n:</font> ", ' minutos')
  68.         if self.runtime == '':
  69.             self.runtime = gutils.trim(self.page, "<font class = 'titulo3'>Duración:</font> ", ' minutos')
  70.  
  71.     def get_genre(self):
  72.         self.genre = gutils.trim(self.page, "<font class = 'titulo3'>GΘnero:</font><br>", '<br><br>')
  73.  
  74.     def get_cast(self):
  75.         self.cast = ''
  76.         self.cast = gutils.trim(self.page, "<font class = 'titulo3'>Actores:</font><br>", '<br><br>')
  77.         self.cast = string.replace(self.cast, '<br>', "\n")
  78.         self.cast = string.strip(gutils.strip_tags(self.cast))
  79.  
  80.     def get_classification(self):
  81.         self.classification = gutils.trim(self.page, "<font class = 'titulo3'>Calificaci≤n moral:</font> ", '<br>')
  82.         if self.classification == '':
  83.             self.classification = gutils.trim(self.page, "<font class = 'titulo3'>Calificación moral:</font> ", '<br>')
  84.  
  85.     def get_studio(self):
  86.         self.studio = ''
  87.  
  88.     def get_o_site(self):
  89.         self.o_site = ''
  90.  
  91.     def get_site(self):
  92.         self.site = "http://www.culturalianet.com/art/ver.php?art=%s" % str(self.movie_id)
  93.  
  94.     def get_trailer(self):
  95.         self.trailer = ''
  96.  
  97.     def get_country(self):
  98.         self.country = gutils.trim(self.page, "<font class = 'titulo3'>Nacionalidad:</font><br>", '<br>')
  99.  
  100.     def get_rating(self):
  101.         self.rating = gutils.trim(self.page, "Puntuaci≤n: <font class = 'titulo3'>", '</font>')
  102.         if self.rating == '':
  103.             self.rating = gutils.trim(self.page, "Puntuación: <font class = 'titulo3'>", '</font>')
  104.         if self.rating:
  105.             self.rating = str(float(gutils.clean(self.rating)))
  106.  
  107. class SearchPlugin(movie.SearchMovie):
  108.  
  109.     def __init__(self):
  110.         self.original_url_search    = 'http://www.culturalianet.com/bus/resu.php?donde=1&texto='
  111.         self.translated_url_search    = 'http://www.culturalianet.com/bus/resu.php?donde=1&texto='
  112.         self.encode = 'iso-8859-15'
  113.  
  114.     def search(self,parent_window):
  115.         self.open_search(parent_window)
  116.         self.sub_search()
  117.         return self.page
  118.  
  119.     def sub_search(self):
  120.         self.page = gutils.trim(self.page, '<b>ARTICULOS ENCONTRADOS:</b>', '</table>')
  121.         self.page = gutils.after(self.page, '</td></tr><tr><td><b>')
  122.         #self.page = self.page.decode('iso-8859-15')
  123.  
  124.     def get_searches(self):
  125.         elements = string.split(self.page, '<td><b>')
  126.  
  127.         if (elements[0]<>''):
  128.             for element in elements:
  129.                 self.ids.append(gutils.trim(element, 'ver.php?art=',"'"))
  130.                 self.titles.append(gutils.strip_tags(gutils.convert_entities(gutils.trim(element, "target='_top'>", '</a>'))))
  131.